﻿using System;
using System.Text;
using System.Drawing;
using System.Collections.Generic;

namespace Ex03.VehicalsObjectModel
{
    public class ElectricCar : PrivateCar, IElectricVehical
    {
        // Members
        private const int k_ChargeCapacity = 240;
        private ElectricEnergySystem m_ElectricEnergySystem;

        // Ctor

        /// <summary>
        /// Creates a new fule based car object
        /// </summary>
        /// <param name="i_LicenseNumber">The license number of the car</param>
        /// <param name="i_CarColor">The color of the car</param>
        /// <param name="i_NumOfDoors">The number of doors on the car</param>
        /// <exception cref="FormatException">When the license number is malformed</exception>
        /// <exception cref="ArgumentException">Too small number of doors</exception>
        internal ElectricCar(
            string i_LicenseNumber, 
            Color i_CarColor,
            int i_NumOfDoors) : 
                base(i_LicenseNumber, new ElectricEnergySystem(k_ChargeCapacity), i_CarColor, i_NumOfDoors)
            {
                m_ElectricEnergySystem = m_EnergySystem as ElectricEnergySystem;
            }

        #region IElectricVehical Members

        /// <summary>
        /// Charges the energy system with a given duration
        /// </summary>
        /// <param name="i_AddedDuration">The duration in minutes</param>
        /// <exception cref="ValueOutOfRangeException">When the amount is negative or exceeds the capacity of the system</exception>
        public void Charge(int i_AddedMinutes)
        {
            m_ElectricEnergySystem.Charge(i_AddedMinutes);
        }

        /// <summary>
        /// Gets the availabe minutes of electiricy in the charge
        /// </summary>
        public int CurrentDuration
        {
            get
            {
                return m_ElectricEnergySystem.CurrentElectricityDuration;
            }
        }

        /// <summary>
        /// Gets the maximum minutes of electiricy the charge can hold
        /// </summary>
        public int MaximumDuration
        {
            get
            {
                return m_ElectricEnergySystem.MaxElectricityDuration;
            }
        }

        #endregion
    }
}
